package com.example.zlw.skindemo;

import android.content.Context;
import android.os.Environment;
import android.support.v4.view.LayoutInflaterCompat;
import android.support.v4.view.LayoutInflaterFactory;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.AttributeSet;
import android.util.Log;
import android.view.View;

import java.io.File;

public class SkinActivity extends AppCompatActivity {

    private static final String TAG = "SkinActivity";
    private SkinFactory skinFactory;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        skinFactory = new SkinFactory();
        LayoutInflaterCompat.setFactory(getLayoutInflater(),skinFactory);
        SkinManager.getOutInstance().init(this);

        super.onCreate(savedInstanceState);
//        setContentView(R.layout.activity_skin);

    }


    public void changeSkin(View view) {
        File file = new File(Environment.getExternalStorageDirectory(), "skin-debug.apk");
        SkinManager.getOutInstance().loadSkin(file.getAbsolutePath());
        skinFactory.apply();
    }
}
